package com.example.demo.service;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-10-03
 * Time: 20:21
 */

//更简单的实现日志的自定义打印
@Controller
@ResponseBody
@Slf4j
//直接替代了得到日志对象
public class UserService {
    //1.得到日志对象
//    private static final Logger log =
//            LoggerFactory.getLogger(UserService.class);

    @RequestMapping("/say")
    //只有注解是Controller这个路由才是有效的
    public void sayHi2(){
        log.trace("我是 trace");
        log.debug("我是 debug");
        log.info("我是 info"); //普通日志
        log.warn("我是 warn");  //警告r
        log.error("我是 error");
    }


}
